home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 590 / source / system.c < prev   
Encoding:
C/C++ Source or Header  |  1992-01-06  |  898 b   |  46 lines

  1. /************************************************************************
  2.  
  3.  
  4.     system(): Aufruf der Shell aus einem anderen Programm aus
  5.  
  6.             von Wolfram Rösler 30.5.91
  7.  
  8. ***********************************************************************/
  9. static char _M_ID_[]="@(#)system.c von wr 30.5.91";
  10.  
  11. #include <osbind.h>
  12.  
  13. #define TEST 0
  14. #define A_shell_p ((long*)0x4f6)
  15.  
  16. int system(st)
  17. char *st;        /* Kommandozeile oder NULL    */
  18. {
  19.   int (*Shell)();
  20.   long ssp;
  21.  
  22.   ssp = Super(0L);
  23.   Shell = (int (*)())*A_shell_p;
  24.   Super(ssp);
  25.  
  26.   if (st)
  27.   {
  28.     if (Shell)
  29.       return (*Shell)(st);
  30.     else
  31.       return -999;    /* keine Shell da... */
  32.   }
  33.   else    /* Testen, ob Shell installiert */
  34.     return Shell!=0;
  35. }
  36.  
  37. #if TEST
  38. main()
  39. {
  40.   system("echo Hallo, hier ist die Okami-Shell");
  41.   system("ver -c");
  42.   system("echo \"^nWeiter mit ENTER\"");
  43.   system("read");
  44. }
  45. #endif
  46.